Crane Softwrights Ltd.Resource Library - Debugging Stylesheets Using Microsoft IE5 XSL ProcessingThis has turned out to be a frequently asked question on the XSL maillist XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list so now this resource can be refered to as a summary of a methodology to debug stylesheets being developed for the Microsoft IE5 XSL engine. This is useful because the menu function View/Source in IE5 shows the XML source, not the HTML resulting from the transformation described by the XSL stylesheet. The page below is excerpted from XSLT training materials that can be obtained through the http://www.CraneSoftwrights.com/training/ page:
The XSL engine in Internet Explorer 5 can be invoked using a tool from Microsoft named the Windows Scripting Host. The script described below will load an XML document and an XSL stylesheet and emit the results of transforming the XML using the XSL. By directing the emitted results to a file, the behaviour of the XSL engine on a given stylesheet is revealed, thus helping with the debugging of the stylesheet logic. |
CRANE
|
Invoking the Microsoft XSL
Processor (cont.) Module 11: Sample Tool Information Lesson 11-2: Microsoft Internet Explorer 5 |
//File: msxsl.js - 1999-08-13 15:40 //Info: http://www.CraneSoftwrights.com/links/msxsl.htm //Args: input-file style-file output-file var xml = WScript.CreateObject("Microsoft.XMLDOM"); //input xml.validateOnParse=false; xml.load(WScript.Arguments(0)); var xsl = WScript.CreateObject("Microsoft.XMLDOM"); //style xsl.validateOnParse=false; xsl.load(WScript.Arguments(1)); var out = WScript.CreateObject("Scripting.FileSystemObject"); //output var replace = true; var unicode = false; //output file properties var hdl = out.CreateTextFile( WScript.Arguments(2), replace, unicode ) hdl.write( xml.transformNode( xsl.documentElement )); //eofA sample invocation batch file (the cscript program is from the Windows Scripting Host utility):
@echo off REM msxsl.bat REM check arguments: %1=source XML, %2=script MSXSL, %3=result HTML cscript //nologo ..\prog\msxsl.js %1 %2 %3 REM post-process resultsA sample invocation:
X:\samp>..\prog\msxsl hello.xml hello.msxsl hello.mshtm X:\samp>type hello.mshtm <b><i><u>Hello world.</u></i></b> X:\samp>
PUBLIC +//ISBN 1-894049::CSL::Courses::PTUX//DOCUMENT Practical Transformation Using XSLT and XPath 1999-08-13 15:40//EN | |
Copyright ©
Crane Softwrights Ltd. http://www.CraneSoftwrights.com (203) |
If anyone has comments on this document, they are welcome to send them to debugmsxsl@CraneSoftwrights.com.